<include file="Core:Public:header" /> {:W('Navigation')}
<div class="body-right">
	<div class="row-table">
		<div class="row-table-title">外卖单列表</div>
		<div class="row-table-body">
			<p class="form-title">
				<a class="pull-right btn btn-primary btn-xs" href="{:U('chrm/order/add')}">添加外卖单</a>
				<volist name="type_array" id="vo">
					<if condition="$key == $type">
						{$vo}&nbsp;&nbsp;&nbsp;
						<else />
						<a href='{:U("chrm/order/lists","type=$key")}'>{$vo}</a>&nbsp;&nbsp;&nbsp;
					</if>
				</volist>
			</p>
			<table class="table table-hover table-striped">
				<thead>
					<tr>
						<th>订单ID</th>
						<th>订单状态</th>
						<th>配送员</th>
						<th>创建时间</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					<volist name="orderlist" id="vo">
						<tr>
							<th>{$vo.oid}</th>
							<th>
								<if condition="$vo['type'] == 1"><span class="text-primary">正常单</span>
									<elseif condition="$vo['type'] == 2" /><span class="text-warning">超时单</span>
									<elseif condition="$vo['type'] == 3" /><span class="text-warning">异常单</span>
									<elseif condition="$vo['type'] == 4" /><span class="text-danger">欺诈单</span>
									<else/><span class="text-danger">赔餐单</span>
								</if>
							</th>
							<th><if condition="$vo['dname'] !=''">{$vo.dname}<else />未设置</if></th>
							<th>{$vo.creattime|date='Y-m-d H:i:s',###}</th>
							<th><a class="del" href="javascript:;" data-toggle="tooltip" 
   data-placement="right" title="删除了就无法恢复的哦，小心操作！" order_id="{$vo.oid}">删除</a></th>
						</tr>
					</volist>
				</tbody>
			</table>
			<div class="col-md-12">{$page}</div>
		</div>
	</div>
</div>
<div class="clear"></div>
<script type="text/javascript">
	/**
	 * Ajax上班打卡
	 * 
	 **/
	$('.del').click(function() {
		var order_id = $(this).attr('order_id');

		$.ajax({
			type: "POST",
			dataType: "JSON",
			url: "{:U('chrm/order/del')}",
			data: {
				oid: order_id
			},
			success: function(data) {
				alert(data.info);
				location.reload();
			},
			error: function(data) {
				alert(data.info);
			}
		});
	});

$(function () { $("[data-toggle='tooltip']").tooltip(); });
</script>
<include file="Core:Public:alert" />
<include file="Core:Public:footer" />